
/**
 * How to read a text file
 * 
 * @author Amrita Mukherjee
 * @version 10/10/2012 
 */
import java.io.*;
import java.util.*;

public class A13_2
{
    public static void main(String[] args) throws IOException
    {
        Scanner reader = new Scanner(new File("contacts.txt"));
        while(reader.hasNextLine()){
            //Read data
            String name = reader.nextLine();
            String phone = reader.nextLine();
            System.out.println("Name=" + name + ", Phone=" + phone + ".");

        }
        reader.close();
        System.out.println("Finished reading file");
    }
}
/*
 * my test session:
 * Name=Amrita Mukherjee, Phone=(408 409 0848).
Name=Om Mandal, Phone=(408 409 0812).
Name=Anaya Mandal, Phone=(409) 445 8424.
Finished reading file

 */